package com.example.lending.Model;

import android.content.Context;
import android.graphics.Path;

import androidx.room.Room;
import androidx.room.RoomDatabase;

import com.example.lending.Model.Dao.BookDao;
import com.example.lending.Model.Dao.BorrowDao;
import com.example.lending.Model.Dao.FavorDao;
import com.example.lending.Model.Dao.OperationDao;
import com.example.lending.Model.Dao.UserDao;

@androidx.room.Database(entities = {Book.class,Borrow.class,Favor.class, Operation.class,User.class},version = 1,exportSchema = false)
public abstract class Database extends RoomDatabase {


    private static Database INSTANCE;
    public static synchronized Database getDatabase(Context context){
        if(INSTANCE == null)
            INSTANCE = Room.databaseBuilder(context.getApplicationContext(),Database.class,"database").build();
        return INSTANCE;
    }
    public abstract BookDao getBookDao();
    public abstract BorrowDao getBorrowDao();
    public abstract FavorDao getFavorDao();
    public abstract OperationDao getOperationDao();
    public abstract UserDao getUserDao();

}
